"use strict";
cc._RF.push(module, '0df2dRKYOlBtK+4irr8xH/e', 'View.CollideShadow');
// Script/2.Home/View.CollideShadow.ts

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const HoomEventCenter_1 = require("./HoomEventCenter");
const Model_RoomEvent_1 = require("./Model.RoomEvent");
const Data_Sprite_1 = require("./Data.Sprite");
const { ccclass, property } = cc._decorator;
let CollideShadow = class CollideShadow extends cc.Component {
    init(colorType) {
        this.node.getComponent(cc.Sprite).spriteFrame = Data_Sprite_1.default.getSpriteFrame(colorType);
        this.node.setPosition(cc.v2(0, 0));
        this.node.scale = 0.6 + (Math.random()) * 0.4;
        this.node.opacity = 100 + (Math.random()) * 150;
        let x = (Math.random() - 0.5) * 250;
        let y = (Math.random() - 0.5) * 250;
        let v2 = cc.v2(x, y);
        let duration = 0.75;
        cc.tween(this.node)
            .by(duration, { scale: 0.1, position: v2 })
            .start();
        cc.tween(this.node)
            .to(duration + 0.1, { opacity: 0 }).call((dt) => this.destroyShadow())
            .start();
    }
    destroyShadow() {
        HoomEventCenter_1.HoomEventCenter.emit(Model_RoomEvent_1.EventType.recycleCollideShadow, this.node);
    }
    //重新使用时
    reuse(data) {
        // this.node.scale=0.3+(Math.random())*0.4;
        // this.node.opacity=150;
    }
    //回收时
    unuse(data) {
    }
};
CollideShadow = __decorate([
    ccclass
], CollideShadow);
exports.default = CollideShadow;

cc._RF.pop();